<template>
    <div class="infomation">
        <!-- 主体容器 -->
        <div class="container">
            <div class="header_text"><strong style="color: rgba(80, 80, 80, 1); margin: 40px;">请填写基本信息</strong></div>
            <!-- 内容主体 -->
            <div class="content">
                <div class="header_box">
                    <img :src="header_img" class="header_img">
                </div>
                <!-- 六个表单 -->
                <div class="form_box">
                    <el-form ref="form" :model="form" :rules="rules">
                        <el-form-item label-width="0" prop="name">
                            <el-input v-model="form.name" size="small" placeholder="请输入姓名"></el-input>
                        </el-form-item>
                        <el-form-item prop="date">
                            <el-date-picker style="width: 100%;" size="small" v-model="form.date" type="date"
                                placeholder="选择出生日期">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item>
                            <el-form-item label-wdith="0" prop="sex">
                                <el-radio-group size="small" v-model="form.sex" class="choose_sex">
                                    <el-radio border label="男" style="width: 50%;"></el-radio>
                                    <el-radio border label="女" style="width: 50%;"></el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-form-item>
                        <el-form-item>
                            <el-form-item label-wdith="0" prop="area">
                                <el-select v-model="form.area" placeholder="请选地区" size="small" style="width: 100%;">
                                    <el-option v-for="(item, id) in areaList" :key="id" :value="item"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-form-item>
                        <el-form-item prop="email">
                            <el-input v-model="form.email" size="small" placeholder="请输入邮箱地址"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-form-item label-wdith="0" prop="student">
                                <el-radio-group size="small" v-model="form.student" class="choose_sex">
                                    <el-radio border label="学生" style="width: 50%;"></el-radio>
                                    <el-radio border label="非学生" style="width: 50%;"></el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-form-item>
                        <!-- </el-form-item> -->
                    </el-form>
                </div>
                <!-- 按键部分 -->
                <div class="btn">
                    <button @click="next('form')">下一步</button>
                </div>
                <!-- 链接部分 -->
                <div class="link_text">
                    <router-link to=""
                        style="text-decoration-color: rgba(0, 179, 138, 1);"><span>下载拉勾客户端，HR消息提醒更及时</span></router-link>
                </div>
            </div>
        </div>
    </div>

</template>

<script>
import "@/assets/css/global.css"
export default {
    name: 'Infomation',
    data() {
        return {
            header_img: require("../../assets/header.jpeg"),
            form: {
                name: '',
                date: '',
                email: '',
                sex: '',
                student: '',
                area: '',
            },
            areaList: [
                '贵阳', '北京', '上海', '深证', '广州', '南京'
            ],
            rules: {
                name: [
                    { required: true, message: ' ', trigger: 'blur' },
                ],
                date: [
                    { type: 'date', required: true, message: ' ', trigger: 'change' }
                ],
                email: [
                    { required: true, message: ' ', trigger: 'blur' },
                ],
                sex: [
                    { required: true, message: ' ', trigger: 'change' },
                ],
                student: [
                    { required: true, message: ' ', trigger: 'change' },
                ],
                area: [
                    { required: true, message: ' ', trigger: 'blur' },
                ],

            }
        }
    },
    methods: {
        next(form) {
            this.$refs[form].validate((valid) => {
                if (valid) {
                    this.$router.push('/infomation2')
                    this.$store.dispatch('updataUser', this.form)
                    console.log(this.$store.state.user)
                } else {
                    return false;
                }
            });
        }
    }
}
</script>

<style scoped>
.infomation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: rgba(0, 179, 138, 1);
}

.container {
    height: 75%;
    width: 30%;
    background-color: white;
    border-radius: 5px;
}

.header_text {
    text-align: left;
    margin-top: 30px;
}

.content {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-direction: column;
}

.header_box {
    height: 80px;
    width: 100%;
    margin: 30px 0px;
    text-align: center;
}

.header_img {
    height: 80px;
    clip-path: circle();
}

.form_box {
    padding: 0 15%;
    width: 100%;
    justify-content: center;
}

.el-form-item {
    margin-bottom: 5px;
}

.choose_sex {
    display: flex;
}

.btn {
    text-align: center;
    width: 100%;
    padding: 10% 15%;
}

.link_text {
    text-align: center;
    font-size: 14px;
}

span {
    color: rgba(0, 179, 138, 1);
}

button {
    width: 100%;
    background-color: rgba(0, 179, 138, 1);
    color: white;
    font-size: 14px;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;

}
</style>